package com.zb.internetSpider.gui.tabsPanel;

import java.awt.Color;
import java.awt.Font;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JTabbedPane;

import org.springframework.stereotype.Component;

import com.zb.internetSpider.gui.SpiderComponent;
import com.zb.internetSpider.gui.SpiderContainer;

/**
 * 切换面板 ClassName: SpiderTabsPanel
 * 
 * @Description: TODO
 * @author zb
 * @date 2019年2月14日 下午4:05:35
 */

public abstract class AbstractSpiderTabsPanel extends JTabbedPane implements SpiderContainer {

	/**
	 * @Fields serialVersionUID : TODO
	 */
	private static final long serialVersionUID = 8540671757840107728L;

	protected List<SpiderContainer> containers = null;

	protected List<SpiderComponent> components = null;

	@Override
	public void setBackGroundColor(Color color) {
		// TODO Auto-generated method stub
		super.setBackground(color);
	}

	@Override
	public void setFont(Font font, Color color) {
		// TODO Auto-generated method stub
		super.setFont(font);
		super.setForeground(color);
	}

	@Override
	public void setSpiderContainers(SpiderContainer... containers) {
		// TODO Auto-generated method stub
		if(containers!=null && this.containers == null) {
			this.containers = new ArrayList<SpiderContainer>();
		}
		
		if(containers != null) {
			for(SpiderContainer container: containers){				
				this.containers.add(container);
			}
		}
		
	}

	@Override
	public void setSpiderComponents(SpiderComponent... components) {
		// TODO Auto-generated method stub
		if(components!=null && this.components == null) {
			this.components = new ArrayList<SpiderComponent>();
		}
		
		if(containers != null) {
			for(SpiderComponent component: components){				
				this.components.add(component);
			}
		}
	}

	@Override
	public SpiderContainer[] getSpiderContainers() {
		// TODO Auto-generated method stub
		return this.containers.toArray(new SpiderContainer[0]);
	}

	@Override
	public SpiderComponent[] getSpiderComponents() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int SpiderContainersCount() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int SpiderComponentsCount() {
		// TODO Auto-generated method stub
		return 0;
	}
	

}
